<?php
$name = $_POST['name'];
$deviceid = $_POST['device_id'];
include $_SERVER['DOCUMENT_ROOT'].'/phpprojects/conn.php';
$sql = "select * from userinfo where name='$name' and deviceid='$deviceid'";
$rs = mysql_query($sql);
if (mysql_num_rows($rs) == 0) {
    die("invalid user:".$name.$deviceid);
}
$realName = $_POST['realName'];
$stuId = $_POST['studentId'];
$sql = "update userinfo set verified=1, real_name='$realName', studentid='$stuId' where name='$name'";
if (mysql_query($sql)) {
	echo "success";
} else {
	echo "db error";
}